package com.umerclass.ui.home;

import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
import com.umerclass.R;
import com.umerclass.frame.model.InfoResult;
import com.umerclass.frame.ui.activity.BaseActivity;
import com.umerclass.ui.anmo.adapter.MyFragmentPagerAdapter;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;

public class VideoBofangActivity extends BaseActivity {

    @BindView(R.id.tab)
    TabLayout tab;
    @BindView(R.id.viewpager)
    ViewPager viewpager;
    private List<String> titles = new ArrayList<>();
    private MyFragmentPagerAdapter myFragmentPagerAdapter;
    private ArrayList<Fragment> fragments = new ArrayList<>();

    @Override
    public boolean isImmersionBarEnabled() {
        return false;
    }

    @Override
    public boolean isSupportSwipeBack() {
        return false;
    }

    @Override
    public int getLayoutResId() {
        return R.layout.activity_video_details2;
    }

    @Override
    public void init() {
        titles.add("课程详情");
        titles.add("课程目录");
        tab.addTab(tab.newTab().setText("课程详情"));
        tab.addTab(tab.newTab().setText("课程目录"));
        fragments.add(ClassDetailsFragment.newInstance());
        fragments.add(ClassDirFragment.newInstance());
        myFragmentPagerAdapter = new MyFragmentPagerAdapter(getSupportFragmentManager());
        myFragmentPagerAdapter.setFragments(fragments);
        myFragmentPagerAdapter.setTitles(titles);
        viewpager.setAdapter(myFragmentPagerAdapter);
        tab.setupWithViewPager(viewpager);
        viewpager.setOffscreenPageLimit(2);
    }

    @Override
    public void loadData() {

    }

    @Override
    protected void onSuccess(int what, InfoResult t) {

    }

    @Override
    protected void onFail(int what, InfoResult t) {

    }
}
